package com.heima.admin.service.impl;

import com.alibaba.fastjson.JSON;
import com.heima.admin.service.NewsAuthService;
import com.heima.apis.wemedia.IWemediaClient;
import com.heima.model.admin.dtos.NewsAuthDto;
import com.heima.model.common.dtos.ResponseResult;
import com.heima.model.common.enums.AppHttpCodeEnum;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class NewsAuthServiceImpl implements NewsAuthService {

    @Autowired
    private IWemediaClient iWemediaClient;

    /**
     * 查询文章列表
     *
     * @param dto
     * @return
     */
    @Override
    public ResponseResult newListVo(NewsAuthDto dto) {
//        NewsAuthDto newsAuthDto = JSON.parseObject(dto, NewsAuthDto.class);
        return  iWemediaClient.newListVo(dto);
    }

    /**
     * 查询单个文章详情
     *
     * @param wmNewsId
     * @return
     */
    @Override
    public ResponseResult oneVoById(Integer wmNewsId) {
       return iWemediaClient.oneVoById(wmNewsId);
    }

    /**
     * 成功审核
     *
     * @param dto
     * @return
     */
    @Override
    public ResponseResult authPass(NewsAuthDto dto) {

       return iWemediaClient.authPass(dto);

    }

    /**
     * 失败审核
     *
     * @param dto
     * @return
     */
    @Override
    public ResponseResult authFail(NewsAuthDto dto) {

        return iWemediaClient.authFail(dto);
    }


}
